/**
 * 贷后管理贷后跟踪控制器
 */
import $_fn from '~plugins'
import './index.less'
export default ['$scope','$rootScope','$location','$ui','http',function($scope,$rootScope,$location,$ui,http) {
    $scope.$_fn = $_fn
	//四级按钮
	$scope.tabMenu = $_fn.getCurrMenu($location.path())
    console.log($scope.tabMenu)
    $scope.subMenu = $scope.tabMenu.children[2].children
    console.log($scope.subMenu)
	console.log('等待放款控制器')
	//四级按钮页面跳转方法
	$scope.operation = function (path,item) {
		console.log('111')
        var _path = path.split('@')
        let params = JSON.stringify(item)
        if(_path[0] == 'link'){
            console.log(path)
            $state.go(_path[1],{id:1,ids:2})
        }
        if(_path[0] == 'alert'){
            $ui.modal({content:"<"+_path[1]+" params="+params+"></"+_path[1]+">"})
        }
   }
	//初始化对象
	$scope.param={
		pageNum:1
	}
	$scope.param1={
		
		status:0
	}
	//获取数据的函数
    $scope.getDada = function(){
        http.post('positionListInit.do',$scope.param,function (data) {
            if(data.errcode > 0){
                //列表无数据
                if(data.data.list.length === 0){
                    $scope.isData = true
                    $scope.$apply()
                }
                $scope.$apply(function () {
                    $scope.param1.dataList = data.data.list;
                    $scope.param1.page = data.data;
                })
            }else{
            	$ui.toast({
					text:data.errmsg,
					type:'warning'
				})
            }
        },function(){
            //报错时
            $scope.isData = true
            $scope.$apply()
        })
    }
	$scope.getDada()
    $scope.select = [{name:'以租代购',value:1},{name:'信贷方式',value:2}]
    $scope.popup = {
        opened: true
    }
    $scope.open = function () {
        $scope.popup.opened = !$scope.popup.opened
    }
}]
